//
//  ContentCell.m
//  Cup
//
//  Created by dllo on 15/4/23.
//  Copyright (c) 2015年 doll. All rights reserved.
//

#import "ContentCell.h"

@implementation ContentCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.perImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.perImage];
        [_perImage release];
        
        self.nameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.nameLabel];
        [_nameLabel release];
        
        self.contLabel = [[UILabel alloc] init];
        self.contLabel.numberOfLines = 0;
        self.contLabel.font = [UIFont systemFontOfSize:14];
        [self.contLabel sizeToFit];
        [self.contentView addSubview:self.contLabel];
        [_contLabel release];
        
        self.timeLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.timeLabel];
        [_timeLabel release];
        
    }
    return self;
}
- (void)dealloc
{
    [_perImage release];
    [_nameLabel release];
    [_contLabel release];
    [_timeLabel release];
    [super dealloc];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.perImage.frame = CGRectMake(15, 10, 50, 50);
    self.perImage.layer.cornerRadius = 25;
    self.perImage.layer.masksToBounds = YES;
    
    self.nameLabel.frame = CGRectMake(80, 10, 150, 50);
    self.nameLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:16];
    
    self.timeLabel.frame = CGRectMake(self.contentView.frame.size.width - 85, 10, 70, 50);
    self.timeLabel.textColor = [UIColor grayColor];
    self.timeLabel.font = [UIFont systemFontOfSize:12];
    
//    self.contLabel.frame = CGRectMake(10, 60, self.contentView.frame.size.width, 50);
    
    
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:14],NSFontAttributeName, nil];
    CGRect rect = [self.contLabel.text boundingRectWithSize:CGSizeMake(self.contentView.frame.size.width - 30, 400) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    self.contLabel.frame = CGRectMake(15, 80, self.contentView.frame.size.width - 30, rect.size.height);

    
    
}



- (void)awakeFromNib {
 }

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
